//
//  main.cpp
//  STL_TEST
//
//  Created by huge on 2021/6/24.
//  Copyright © 2021 huge. All rights reserved.
//

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>    // std::equal
#include <queue>

using namespace std;

class Prefix
{
private:
//    vector<string> mStrs = {"abca","abc","abca","abc","abcc"};
    
public:
    string FindLongestPrefix(vector<string>const &strs){
        
        //判断数组是否为空
        if (!strs.size()) {
            return "";
        }
        
        string tempStr;
        //取出第一个字符串
        string firstStr = strs[0];
        
        int count = (int)firstStr.size();
        //遍历第一个字符串
        for (int i=0; i<count; i++) {

            //依次次和后面的字符串比较，如果有一个不同break，当前字符串就是最大前缀
            
            for (int j=0; j<strs.size(); j++) {
                if(firstStr[i] == strs[j][i] ){
                    if ( j == (strs.size()-1)) {
                        tempStr.push_back(firstStr[i]);
                        cout << "current tempStr: " << tempStr << endl;
                    }
                }else{
                    cout << "break break: " << endl;
                    break;

                }
            }
        }
        
        return tempStr;
    }
    
    
};

int main(int argc, const char * argv[]) {
    // insert code here...
//
//    vector<string> strs = {"abca","abc","abca","abc","abcc"};
//
//    Prefix* pObject = new Prefix();
//    string longestStr = pObject->FindLongestPrefix(strs);
//    cout << "the longest string is: " << longestStr << endl;
    
    
    priority_queue<int> priQue;
    priQue.push(3);
    priQue.push(1);
    priQue.push(9);

    while (!priQue.empty()) {
        
        cout <<"priQue: "<<priQue.top()<<endl;
        priQue.pop();
    }
    
    return 0;
}
